package com.ruoyi.apis.controller;

import com.ruoyi.apis.service.IDisplayService;
import com.ruoyi.apis.vo.DisplayVO;
import com.ruoyi.common.core.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.Min;
import java.util.List;

/**
 * @Author Choi
 * @Date 2021/8/23
 */

@Api(value = "展示屏", tags = "展示屏相关接口")
@RestController
@RequestMapping("/api")
@Validated
public class IDisplayController {

    @Autowired
    private IDisplayService displayService;

    /**
     * 展示屏
     */
    @ApiOperation(value = "展示屏")
    @GetMapping("/cities/{id}/display")
    public AjaxResult display(@ApiParam(name = "id", value = "城市ID", required = true)
                              @PathVariable @Min(value = 1) long id) {
        List<DisplayVO> displays = displayService.getDisplays(id);
        return AjaxResult.success(displays);
    }
}
